#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <network.h>

int main()
{
	Network* nw = open_network('c',SOCK_DGRAM,"",6699);
	if(NULL == nw)
	{
		printf("open network socket null!!\n");
		return -1;
		}
	char buf[1024] = {};
	for(;;)
	{
		printf(">");
		gets(buf);
		nsend(nw,buf,strlen(buf)+1);
		if(0 == strcmp("exit",buf))
		{
			printf("通信结束！\n");
			close_network(nw);
			}
		}
		nsecv(nw,buf,sizeof(buf));
	}
